package com.limanyik.family.kernel.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.limanyik.family.common.utils.FamilyHttpRequest;
import com.limanyik.family.common.utils.FamilyHttpResponse;
import com.limanyik.family.kernel.communication.dto.FamilyBucketInfoDto;
import com.limanyik.family.kernel.communication.vo.FamilyBucketInfoVo;
import com.limanyik.family.kernel.service.FamilyBucketInfoService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.Resource;
import java.util.List;

/**
 * 家庭桶信息表 前端控制器API
 *
 * @author limanyi
 * @since 2022-01-24
 */
@RestController
@Slf4j
public class FamilyBucketInfoController {

    @Resource(name = "familyBucketInfoServiceImpl")
    FamilyBucketInfoService familyBucketInfoService;

    /**
     * 获取指定人员的家庭成员信息
     *
     * @param familyHttpRequest
     * @return
     */
    @PostMapping("/bucket/info/getFamilyBucketInfoByUserId")
    public FamilyHttpResponse<List<FamilyBucketInfoVo>> getFamilyBucketInfoByUserId(FamilyHttpRequest<FamilyBucketInfoDto> familyHttpRequest) {
        return familyBucketInfoService.getFamilyBucketInfoByUserId(familyHttpRequest.getData());
    }

    /**
     * 获取指定人员的家庭成员分页信息
     *
     * @param familyHttpRequest
     * @return
     */
    @PostMapping("/bucket/info/getFamilyBucketInfoPageByUserId")
    public FamilyHttpResponse<IPage<FamilyBucketInfoVo>> getFamilyBucketInfoPageByUserId(FamilyHttpRequest<FamilyBucketInfoDto> familyHttpRequest) {
        return familyBucketInfoService.getFamilyBucketInfoPageByUserId(familyHttpRequest.getData());
    }

}
